# -*- coding:utf-8 -*-
import yaml


def get_yaml_data(fileDir):
    fo = open(fileDir, 'r', encoding = 'utf-8')
    # 使用yaml方法读取数据
    res = yaml.load(fo, Loader=yaml.FullLoader)
    fo.close()
    return res

def get_yaml_api_args(arg):
    """
    arg: get_yaml_data返回yaml用例的所有参数值
    return 用例中的url, resp_code, resp_mes, method, params,case_name
    """
    url = arg['api_request']['url']
    resp_code = arg['api_response']['code']
    resp_mes = arg['api_response']['message']
    method = arg['api_request']['method']
    params = arg['api_request']['params']
    case_name = arg['case_name']
    return url, resp_code, resp_mes, method, params, case_name

# if __name__ == '__main__':
#     re = get_yaml_data('../data/dataset_Case_01.yaml')
#     print(re)